//
//  zhutiCollectionViewCell3.m
//  BAOASystem
//
//  Created by michael on 2018/5/22.
//  Copyright © 2018年 czd. All rights reserved.
//

#import "zhutiCollectionViewCell3.h"

@implementation zhutiCollectionViewCell3
-(void)setDic:(NSDictionary *)dic{
    _dic = dic;
   
}
- (void)layoutSubviews{
[super layoutSubviews];
 [_imageview sd_setImageWithURL:[NSURL URLWithString:_dic[@"companyImage"]] placeholderImage:[UIImage imageNamed:@"加载"]];
    NSArray *ctgMainPushProductarray = _dic[@"cppdlist"];
if (ctgMainPushProductarray.count!=0) {
  NSDictionary *dic =ctgMainPushProductarray[0];
[_button1 sd_setImageWithURL:[NSURL URLWithString:dic[@"fileurl"]] forState:UIControlStateNormal];
_labeltop1.text = dic[@"title"];
if (![dic[@"isPrice"] isEqualToString:@"0"]) {
//商品详情-价格面议
NSString *money =NSLocalizedString(@"钱", nil);
    _labelbom1.text =[NSString stringWithFormat:@"%@%@",money,dic[@"price"]] ;
}else{
    _labelbom1.text =NSLocalizedString(@"商品详情-价格面议", nil);
}
if (ctgMainPushProductarray.count>1) {
[_button2 sd_setImageWithURL:[NSURL URLWithString:ctgMainPushProductarray[1][@"fileurl"]] forState:UIControlStateNormal];
_labeltop2.text = ctgMainPushProductarray[1][@"title"];
if (![ctgMainPushProductarray[1][@"isPrice"] isEqualToString:@"0"]) {
//商品详情-价格面议
NSString *money =NSLocalizedString(@"钱", nil);
    _labelbom2.text =[NSString stringWithFormat:@"%@%@",money,ctgMainPushProductarray[1][@"price"]] ;
}else{
    _labelbom2.text =NSLocalizedString(@"商品详情-价格面议", nil);
}


}
if (ctgMainPushProductarray.count>2) {
[_button3 sd_setImageWithURL:[NSURL URLWithString:ctgMainPushProductarray[2][@"fileurl"]] forState:UIControlStateNormal];
_labeltop3.text = ctgMainPushProductarray[2][@"title"];
if (![ctgMainPushProductarray[2][@"isPrice"] isEqualToString:@"0"]) {
//商品详情-价格面议
NSString *money =NSLocalizedString(@"钱", nil);
    _labelbom3.text =[NSString stringWithFormat:@"%@%@",money,ctgMainPushProductarray[2][@"price"]] ;
}else{
    _labelbom3.text =NSLocalizedString(@"商品详情-价格面议", nil);
}


}
if (ctgMainPushProductarray.count>3) {
[_button4 sd_setImageWithURL:[NSURL URLWithString:ctgMainPushProductarray[3][@"fileurl"]] forState:UIControlStateNormal];
_labeltop4.text = ctgMainPushProductarray[3][@"title"];
if (![ctgMainPushProductarray[3][@"isPrice"] isEqualToString:@"0"]) {
//商品详情-价格面议
NSString *money =NSLocalizedString(@"钱", nil);
    _labelbom4.text =[NSString stringWithFormat:@"%@%@",money,ctgMainPushProductarray[3][@"price"]] ;
}else{
    _labelbom4.text =NSLocalizedString(@"商品详情-价格面议", nil);
}


}

}
    // Initialization code
}
- (void)awakeFromNib {
    [super awakeFromNib];
   
}

- (IBAction)action1:(id)sender {
NSArray *ctgMainPushProductarray = _dic[@"cppdlist"];
if (ctgMainPushProductarray.count>0){
NSDictionary *dic =ctgMainPushProductarray[0];

shangpinxqViewController *vc = [[shangpinxqViewController alloc]init];
vc.pdid = dic[@"id"];
vc.hidesBottomBarWhenPushed = YES;
[self.ViewController.navigationController pushViewController:vc animated:YES];
}
}

- (IBAction)action2:(id)sender {
NSArray *ctgMainPushProductarray = _dic[@"cppdlist"];
if (ctgMainPushProductarray.count>1){
NSDictionary *dic =ctgMainPushProductarray[1];

shangpinxqViewController *vc = [[shangpinxqViewController alloc]init];
vc.pdid = dic[@"id"];
vc.hidesBottomBarWhenPushed = YES;
[self.ViewController.navigationController pushViewController:vc animated:YES];
}
}

- (IBAction)action3:(id)sender {
NSArray *ctgMainPushProductarray = _dic[@"cppdlist"];
NSDictionary *dic =ctgMainPushProductarray[2];
if (ctgMainPushProductarray.count>2){

shangpinxqViewController *vc = [[shangpinxqViewController alloc]init];
vc.pdid = dic[@"id"];
vc.hidesBottomBarWhenPushed = YES;
[self.ViewController.navigationController pushViewController:vc animated:YES];
}
}

- (IBAction)action4:(id)sender {
NSArray *ctgMainPushProductarray = _dic[@"cppdlist"];
if (ctgMainPushProductarray.count>3){
NSDictionary *dic =ctgMainPushProductarray[3];

shangpinxqViewController *vc = [[shangpinxqViewController alloc]init];
vc.pdid = dic[@"id"];
vc.hidesBottomBarWhenPushed = YES;
[self.ViewController.navigationController pushViewController:vc animated:YES];
}
}
@end
